//  ts 中类的访问修饰符：只读属性，只可在类型声明时或者构造函数初始化，
// 不能再进行属性赋值或者修改
 class Person{
     public name:string
     private age:number
     protected readonly gender:boolean    //只读属性，只能在构造函数的初始化定义或者

     constructor(name:string,age:number){
         this.name =name
         this.age = age
         this.gender = true
     }
     sayName(msg:string):void{
         return console.log(`This is a ${msg},${this.name},${this.age},${this.gender}`);
     }
 }
 class Son extends Person{
     constructor(name:string,age:number){
         super(name,age)
            console.log(`This is protected gender ${this.gender},lastNmae${this.name}`);
            
        }

 }
//  p.gender = false


 const p = new Person("tome",18)
 const p2 = new Son('jery',5)
 p.sayName('hahaha')
//  console.log("person",p);
//  console.log("son",p2);
 
//  console.log("public name",p.name);
//  console.log("private age",p.age);
//  console.log("protected gender",p.gender);
 
 
 
 
 